export function bind<T extends Function>(fn:T, thisArgs:unknown) {
  return fn
}

export function extend<T extends object, U extends object>(target:T, source:U, thisArg?:unknown) {
  const extraProps = Reflect.ownKeys(source).filter(name=>name !== 'constructor') 

  for(const prop of extraProps) {
    const value = Reflect.get(source, prop)
    Reflect.set(target, prop, value)
  }
}

export function merge<T extends object, U extends object>(obj:T, other:U):T&U {
  const result = {...obj}

  for(const prop in other) {

  }

  return result as T&U
}

export function getEnv() {
  const name = Object.prototype.toString.call(globalThis)
  return name === '[object Window]' ? 'browser' : 'node'
}

export function each<T>(arr:T[], callback:(item:T, index:number, arr:T[])=>void) {
  for(let i = 0; i < arr.length; i++) {
    callback(arr[i], i, arr)
  }
}

export function isPlainObject() {}
